package com.zjsd.sqeybusiness.utils;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class WeChatNameGenerator {
    // 中国各省级行政区名称首字
    private static final String[] PROVINCE_FIRST_CHARS = {
            "北", "天", "河", "山", "内", "辽", "吉", "黑",
            "上", "江", "浙", "安", "福", "江", "山", "河",
            "湖", "湖", "广", "广", "海", "重", "四", "贵",
            "云", "西", "陕", "甘", "青", "宁", "新", "香",
            "澳", "台"
    };

    // 用于生成随机后缀的字符集
    private static final String CHAR_SET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

    public static String generateWeChatName() {
        Random random = new Random();
        // 随机选择一个省级行政区首字
        String firstChar = PROVINCE_FIRST_CHARS[random.nextInt(PROVINCE_FIRST_CHARS.length)];

        // 随机生成 3 - 10 位的后缀
        int suffixLength = random.nextInt(8) + 3;
        StringBuilder suffix = new StringBuilder();
        for (int i = 0; i < suffixLength; i++) {
            int charIndex = random.nextInt(CHAR_SET.length());
            suffix.append(CHAR_SET.charAt(charIndex));
        }

        return firstChar + suffix;
    }

    public static void main(String[] args) {
        // 测试生成 10 个微信名
        for (int i = 0; i < 10; i++) {
            System.out.println(generateWeChatName());
        }
    }
}